package schoolWork.work03.text6;

public class MultiChoiceQuestion extends ChoiceQuestion {
    private String choiceString = "";
    private int numberOfChoices;

    public void addchoice(String choice, boolean correct) {
        super.addchoice(choice, correct);

        numberOfChoices++;
        if (correct) {
            if (choiceString.length() == 0)
                choiceString = "" + numberOfChoices;
            else
                choiceString = choiceString + " " + numberOfChoices;
        }
        setAnswer(choiceString);
    }

    public void display() {
        super.display();
        System.out.println("请输入正确答案的编号，用空格分开。");
    }
}
